package sb.de.advanceShopper.activities;

import java.util.List;

import sb.de.advanceShopper.R;
import sb.de.advanceShopper.dataBase.ShopsDataSource;
import sb.de.advanceShopper.model.Shop;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;

public class ShopsActivity extends ListActivity {

	private ShopsDataSource shopsDS;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.shops);

		shopsDS = new ShopsDataSource(this);

		List<Shop> values = shopsDS.getAllShops();

		// Use the SimpleCursorAdapter to show the
		// elements in a ListView
		ArrayAdapter<Shop> adapter = new ArrayAdapter<Shop>(this,
				android.R.layout.simple_list_item_1, values);
		setListAdapter(adapter);
	}

	public void addShop(View v) {
		Intent intentAddShop = new Intent(this, AddShopActivity.class);
		startActivity(intentAddShop);
	}

	public void selectShop(View v) {
		// TextView tv1 = (TextView) findViewById(R.id.textView1);
		// TextView tv2 = (TextView) findViewById(R.id.textView2);
		// TextView tv3 = (TextView) findViewById(R.id.textView3);
		// Shop sh = ds.getAllShops().get(0);
		// tv1.setText(Long.toString(sh.getIndex()));
		// tv2.setText(sh.getName());
		// tv3.setText(sh.getDescription());
	}

}
